<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>完成付款</title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="__INDEX__/css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" href="__INDEX__/css/style.css" />
		<link rel="stylesheet" href="__INDEX__/css/iconfont.css" />
		<link rel="stylesheet" href="__INDEX__/css/mall.css" />
	</head>
<body>
	<div class="mui-content paymentcg_content">
		<div class="fukc_top">
				<div class="iconfont icon-weixin2" style="display: none;"></div>
				<div class="iconfont icon-zhifubao1" style="display: none;"></div>
			<p id='is_success'></p>
			<div class="fukc_pribox">¥<em id='pay_money'></em></div>
		</div>
		<div class="fukc_djh clearfix">
			<span class="left">单据号</span>
			<span class="right" id='sn'></span>
		</div>
		<div class="fukc_xq clearfix">
			<div class="left">付款详情</div>
			<div class="right">
				<p class="clearfix is_jif">
					<Span class="pleft" id='pay_model'></Span>
					<span class="pright"><em id='pay_money2'></em>元</span>
				</p>
			</div>
		</div>
		<div class="qitsj_lisbox" style="margin-bottom: 50px;">
			<div class="bt" style="padding: unset;"><img src="__PUBLIC__/static/index/images/payment_ct.jpg"></div>
			<ul class="qitsj_lis" id='item_ul'>
				<!--<li class="clearfix">
					<div class="tjsj_img"><img src="../images/bgtu.jpg"></div>
					<div class="tjsj_info">
						<div class="tjsj_nam">
							<div class="name">英豪大酒店</div>
							<div class="iconfont icon-new"></div>
						</div>
						<div class="tjsj_jif">鼓励金最高可抵<em>100%</em></div>
						<div class="tjsj_dzbox clearfix">
							<div class="tjsj_dz">北湖区，南岭大道辅路</div>
							<div class="tjsj_jul">3.295km</div>
						</div>
					</div>
				</li>-->
			</ul>
		</div>
		<div class="mask">
			<div class="fuk_bdsj">
				<p class="bt">绑定手机号</p>
				<!--<p><img src="__PUBLIC__/static/images/bac_bdsj.jpg"></p>-->
				<p class="tip">绑定手机号，让您的账户更加安全</p>
				<p class="number"><input type="number" name="" id="member_mobile" value="" placeholder="请输入您的手机号" /></p>
				<div class="yzm clearfix">
					<input type="text" name="" id="yzm" value="" placeholder="请输入验证码" />
					<button type="button" class="fuk_yzmbtn" id="send_code">获取验证码</button>
				</div>
				<p><button type="button" class="fukc_btn" id='bd_mobile'>确定</button></p>
			</div>			
		</div>
	</div>
	{include file="public/bottom" /}
</body>
{include file="public/footer" /}
<script src="__PUBLIC__/static/js/mui.min.js"></script>
<script type="text/javascript" src="https://webapi.amap.com/maps?v=1.4.2&key=eef7f290ac06bdf05b246cebc8cb2fb6&callback=my_getAddress"></script>
<script src="__PUBLIC__/static/js/assist.js"></script>
<script type="text/javascript">
	var index = layer.load(0, {shade: false,time: 1 * 1000});
	mui.init();
	var aniShow = "pop-in";
	//页面跳转
	mui('#footer-list').on('tap', 'a', function() {
		var id = this.getAttribute('href');
		var href = this.href;
		mui.openWindow({
			id: id,
			url: this.href,
			show: {
				aniShow: aniShow
			},
			waiting: {
				autoShow: false
			}
		});
	});
</script>
<script>
//获取用户当前地址
var map, geolocation;
function my_getAddress(){
    //加载地图，调用浏览器定位服务
    map = new AMap.Map('container', {
        resizeEnable: true
    });
    map.plugin('AMap.Geolocation', function() {
        geolocation = new AMap.Geolocation({
            enableHighAccuracy: true,//是否使用高精度定位，默认:true
            timeout: 10000,          //超过10秒后停止定位，默认：无穷大
            buttonOffset: new AMap.Pixel(10, 20),//定位按钮与设置的停靠位置的偏移量，默认：Pixel(10, 20)
            zoomToAccuracy: true,      //定位成功后调整地图视野范围使定位位置及精度范围视野内可见，默认：false
            buttonPosition:'RB'
        });
        map.addControl(geolocation);
        geolocation.getCurrentPosition();
        AMap.event.addListener(geolocation, 'complete', onComplete);//返回定位信息
    });
    $('#container').hide();
    //解析定位结果
    function onComplete(data) {
    	$.ajax({
		   	type:"post",
		   	data:{
		   		longitude	: data.position.getLng(),
		   		latitude	: data.position.getLat(),
		   		order_sn	: getUrlParam('order_sn')
		   	},
		   	url:"{:url('index/pay/pay_success')}",
		   	success:function(data){
		   		//付款信息
		   		var pay_log_info = data.pay_info.pay_log_info;
		   		if(pay_log_info && pay_log_info['state'] == 2){
		   			$('#is_success').text('付款成功')
		   			//付款方式
		   			if(pay_log_info['pay_type'] == 2){
			   			$('.icon-weixin2').show();
			   			$('#pay_model').text('微信支付');
			   		}else{
			   			$('.icon-zhifubao1').show();
			   			$('#pay_model').text('支付宝支付');
			   		}
		   			//付款金额
		   			$('#pay_money').text(pay_log_info['balance']);
		   			$('#pay_money2').text(pay_log_info['balance']);
		   			//订单号
		   			$('#sn').text(pay_log_info['order_sn']);
		   			//赠送鼓励金
		   			$('#s_pay_score').val(pay_log_info['member_score'])
		   			//抵扣鼓励金
		   			$('#j_pay_score').val(pay_log_info['agent_score'])
		   			if(pay_log_info['member_score']>0){
		   				$('.zengsong').show();
		   			}
		   			if(pay_log_info['agent_score']>0){
		   				$('.dixian').show();
		   			}
		   			
		   		}else{
		   			$('#is_success').text('付款失败')
		   		}
		   		
		   		//附件商户
		   		var list = data.pay_info.agent_list;
		   		var html="";
		   		if(list){
		   			for(var o in list){
		   				var agent=list[o];
		   				var juli = agent.juli;
		   				var diz = agent.address;
		   				var begin_time = ''
		   				var end_time = '';
		   				var dk=0;
		   				if(agent.is_score==1){
		   					dk=agent.ad_score;
		   				}
		   				var action=agent['action'];
		   				if(action==null){
		   					action="暂无";
		   				}
		   				if(juli<1000){
		   					juli = "<1k";
		   				}
		   				if(diz && diz.length>0){
		   					diz = agent.address;
		   				}else{
		   					diz = '暂无';
		   				}
		   				if(agent.start_time && agent.start_time.length>0){
		   					begin_time = agent.start_time.substr(0,agent.start_time.length-3);
		   				}else{
		   					begin_time = '00:00';
		   				}
		   				if(agent.end_time && agent.end_time.length>0){
		   					end_time = agent.end_time.substr(0,agent.end_time.length-3);;
		   				}else{
		   					end_time = '00:00';
		   				}
		   				var logo=agent.logo;
		   				if(!logo){
		   					logo="__PUBLIC__/static/index/images/noimage.jpg";
		   				}
						html += "<li>"
							  +"<a href='/index/index/shop_info?agent_id="+agent.id+"' class='clearfix'>"
							  +"<div class='index_sjimg'><img src='"+logo+"'></div>"
							  +"<div class='index_sjinfo'>"
							  +"<div class='index_spname'>"+agent.agent_name+"</div>"
							  +"<div class='index_spstyle clearfix'>"
							  +"<span>"+diz+"</span>"
							  +"<span class='index_sjdw'><i class='iconfont'></i>"+juli+"m</span>"
							  +"</div>"
							  +"<div class='index_dkbox clearfix'>"
							  +"<em class='index_dkbl'>鼓励金抵扣</em>"
							  +"<em class='index_dkbr'>"+dk+"%</em>"
							  +"</div>"
							  +"</div></a>"
							  +"<div class='shopzxhd'><span style='color:#333;font-weight:bold;'>最新活动&nbsp;:&nbsp;</span><span style='margin-left:5px'>"+action+"</span></div>"
							  +"</li>";
					}
		   			$("#item_ul").html(html);
		   		}else{
		   			$("#item_ul").html("<li>附近无商铺<li>");
		   		}
		   	}
		});
    }
}
</script>